#include <iostream>
#include <any>
#include <memory>

using FilePtr = std::shared_ptr<FILE>;
std::any func(std::any a) {
    return a;
}
int main()
{
    std::cout << std::boolalpha;
    // any 类型
    std::any a = 1;
	/*
    std::cout << a.type().name() << ": " << std::any_cast<int>(a) << '\n';
    a = 3.14;
    std::cout << a.type().name() << ": " << std::any_cast<double>(a) << '\n';
    a = true;
    std::cout << a.type().name() << ": " << std::any_cast<bool>(a) << '\n';
	*/
    FILE* fp = fopen("a.txt","r+");
    FilePtr fptr(fp, ::fclose);

    a = fptr;
    FilePtr fp2 = std::any_cast<FilePtr>(a);
	
    a = func(a);

	a = 1;
    int* i = std::any_cast<int>(&a);
    std::cout << *i << "\n";

	
	return 0;
}